package com.ruoyi.web.controller.system;

import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.edh.domain.SysFeeback;
import com.ruoyi.edh.service.SysFeebackService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @version :
 * @program: easyBuy
 * @description:
 * @author: 周爱鸿
 * @create: 2020-11-06 18:05
 **/
@RestController
@RequestMapping("/system/feeback")
public class SysFeebackController extends BaseController {

	@Autowired
	private SysFeebackService sysFeebackService;

	@PostMapping
	public AjaxResult insert(@RequestBody JSONObject params){
		String remake = params.getString("remake");
		String phone = params.getString("phone");
		return toAjax(sysFeebackService.insert(remake,phone));
	}
	/**
	 * 查询【请填写功能名称】列表
	 */
	@GetMapping("/list")
	public TableDataInfo list(SysFeeback sysFeeback)
	{
		startPage();
		List<SysFeeback> list = sysFeebackService.selectSysFeebackList(sysFeeback);
		return getDataTable(list);
	}

	/**
	 * 导出【请填写功能名称】列表
	 */
	@GetMapping("/export")
	public AjaxResult export(SysFeeback sysFeeback)
	{
		List<SysFeeback> list = sysFeebackService.selectSysFeebackList(sysFeeback);
		ExcelUtil<SysFeeback> util = new ExcelUtil<SysFeeback>(SysFeeback.class);
		return util.exportExcel(list, "feeback");
	}

	/**
	 * 获取【请填写功能名称】详细信息
	 */
	@GetMapping("/{id}")
	public AjaxResult getInfo(@PathVariable Long id)
	{
		return AjaxResult.success(sysFeebackService.selectSysFeebackById(id));
	}

	/**
	 * 新增【请填写功能名称】
	 */
	@PostMapping("/insert")
	public AjaxResult add(@RequestBody SysFeeback sysFeeback)
	{
		return toAjax(sysFeebackService.insertSysFeeback(sysFeeback));
	}

	/**
	 * 修改【请填写功能名称】
	 */
	@PutMapping
	public AjaxResult edit(@RequestBody SysFeeback sysFeeback)
	{
		return toAjax(sysFeebackService.updateSysFeeback(sysFeeback));
	}

	/**
	 * 删除【请填写功能名称】
	 */
	@DeleteMapping("/{ids}")
	public AjaxResult remove( @PathVariable Long[] ids)
	{
		return toAjax(sysFeebackService.deleteSysFeebackByIds(ids));
	}
}
